<?php
ini_set("display_errors", "On");
error_reporting(E_ALL);

// 引入数据库连接文件
require_once '../../../../../sql/connection.php';

$classID = $_POST['connClassID'];
$connGuideID = $_POST['connGuideID'];

$now = date('Y-m-d H:i:s', time());

$updateSql = "UPDATE class_info set update_time = '$now', guide_id = '$connGuideID' where id = '$classID'";

if (mysqli_query($GLOBALS['conn'], $updateSql)) {
	echo "
            <script>
                alert('关联成功！');
                window.location.href=document.referrer;
            </script>
        ";
} else {
	echo "
            <script>
                alert('关联失败！');
                history.back();
            </script>
        ";
}
